<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s"  uri="/struts-tags"%>
<%@ taglib prefix="p" uri="/WEB-INF/page_qidi.tld"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
 	String path = request.getContextPath();
 	String basePath = request.getScheme() + "://"
 			+ request.getServerName() + ":" + request.getServerPort()
 			+ path + "/";
 %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>管理公告通知</title>
<link type="text/css" rel="stylesheet" href="http://img.xxt.m-school.cn/wisdom/style/style.css">
<script type="text/javascript" language="javascript" src="http://img.xxt.m-school.cn/wisdom/js/mode.js"></script>
<script type="text/javascript" language="javascript" src="http://img.xxt.m-school.cn/wisdom/js/tableList.js"></script>
<script type='text/javascript'
			src='${pageContext.request.contextPath}/dwr/interface/examDwr.js'></script>
		<script type='text/javascript'
			src='${pageContext.request.contextPath}/dwr/engine.js'></script>
		<script type='text/javascript'
			src='${pageContext.request.contextPath}/dwr/util.js'></script>
<script type="text/javascript" language="javascript">
function submitForm(){
		document.getElementById('queryAll').click();
}

function allCheck(a) {

	var check = false;
		if(a.checked){
			check = true;
		}
	    var smObj = document.getElementsByName("checkExam");
            for (var i = 0; i < smObj.length; i++){
                smObj[i].checked = check;
	    	}
	    var smObj1 = document.getElementsByName("checkAllExam");
	    	for (var i = 0; i < smObj1.length; i++){
                smObj1[i].checked = check;
	    	}
}

function submitDeleteForm(){

	
	var temp = 0;
	
	var str="";
	
	var smObj = document.getElementsByName("checkExam");
            for (var i = 0; i < smObj.length; i++){
            	if(smObj[i].checked){
            		temp = 1;
            		break;
            	}
	    }
	
	if(temp==0){
		alert("请选择要删除的考试日程！");
	}else{
		if(confirm("是否删除选中的考试日程?")){
		document.getElementById('deleteExamButton').click();
		}
	}
	
}

function setSfqy(str,date){

	var myDate = new Date();
	var converted = Date.parse(date); 
	var myDate1 = new Date(converted); 
	if(myDate1<myDate){
		alert("考试时间已逾期，请修改后启用！（考试开始时间必须后于当前时间）");
		return false;
	}
	 
	var sfqy = document.getElementById('selectSfqy').value;
	examDwr.setSfqy(sfqy,str, setTdById);
}

function setTdById(data){
	var setselect = document.getElementById('select'+data);
	var setoption = document.getElementById('option'+data);
	setselect.innerHTML="是";
	setoption.innerHTML="<a href='examAction!updateExam?exid="+data+"&total=${requestScope.examList.total}&currentPage=${requestScope.examList.currentPage}&condition=${requestScope.examList.condition}&type=look'>查看</a><a href='examAction!deleteOneExam?exid="+data+"&total=${requestScope.examList.total}&currentPage=${requestScope.examList.currentPage}&condition=${requestScope.examList.condition}'>删除</a>";
}

</script>
</head>

<body class="conBody" onLoad="tableList()" onResize="tableList()">
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td id="conListAlt">
	<form action="examAction!getAllExam" method="post">
	<table border="0" cellspacing="0" cellpadding="0" class="topSelectStyle">
      <tr>
        <td>考试名称：</td>
        <td class="bodyBlock"><input type="text" name="exnameTemp" class="comInputStyle" value="${requestScope.exnameTemp}"></td>
        <td>考试类别：</td>
        <td class="bodyBlock"><select name="exlbTemp" class="comInputStyle">
        <option value="n" selected="selected">请选择考试类别</option>
        <option value="1">大考</option>
        <option value="2">年级考试</option>
        <option value="3">测验（小考）</option>
        </select></td>
        
        <td>&nbsp;</td>
      
        
        <td>考试时间：</td>
        <td class="bodyBlock"><input type="text" name="exsjTemp" class="comInputStyle" onClick="WdatePicker({skin:'whyGreen'})" value="${requestScope.exsjTemp}"/></td>
        
        <td><input type="submit" id="queryAll" style="display: none;"/><a href="#" onclick="submitForm()">查询</a></td>
      </tr>
    </table>
	</form>
	</td>
  </tr>
  <tr>
    <td align="left" valign="top">
	<table border="0" id="mainThead" cellpadding="0" cellspacing="0" class="listHeadBg">
      <tr>
        <th>&nbsp;</th>
		<th><input name="checkAllExam" type="checkbox" value="" onclick="allCheck(this)"></th>
        <th>考试名称</th>
        <th>考试类别</th>
        <th>开始时间</th>
        <th>结束时间</th>
        <th>操作</th>
      </tr>
	</table>
	<form action="examAction!deleteAllExam" method="post">
	<div id="srcollTable">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" id="mainTbody" class="covBodyTd">
	  <tr>
		<th>&nbsp;</th>
		<th><input name="checkAllExam" type="checkbox" value="" onclick="allCheck(this)"></th>
        <th>考试名称</th>
        <th>考试类别</th>
        <th>开始时间</th>
        <th>结束时间</th>
        <th>操作</th>
	  </tr>
	  <s:iterator value="#request.examList.listResult" id="n">
	  <tr onMouseOver="this.className = 'tronMouseover'" onMouseOut="this.className = 'tronMouseout'" class="tronMouseout">
		<td>&nbsp;</td>
		<td align="center"><input name="checkExam" type="checkbox" value="<s:property value="exId"/>"></td>
        <td align="center"><s:property value="exName"/></td>
        <td align="center"><s:property value="kslbname"/></td>
        <td align="center"><s:property value="exStarttime"/></td>
        <td align="center"><s:property value="exEndtime"/></td>
		
        <td align="center" class="rightButBak" id="option<s:property value="exId"/>">
        <s:a href="examAction!updateExam?exid=%{exId}&total=%{#request.examList.total}&currentPage=%{#request.examList.currentPage}&condition=%{#request.examList.condition}&type=update">修改</s:a>
        <s:a href="examAction!deleteOneExam?exid=%{exId}&total=%{#request.examList.total}&currentPage=%{#request.examList.currentPage}&condition=%{#request.examList.condition}" onclick="return confirm('是否删除考试日程?')">删除</s:a>
        </td>
	  </tr>
	  </s:iterator>
	</table>
	</div>
	<input type="hidden" name="total" value="${requestScope.examList.total}"/>
	<input type="hidden" name="currentPage" value="${requestScope.examList.currentPage}"/>
	<input type="hidden" name="condition" value="${requestScope.examList.condition}"/>
	<input type="submit" id="deleteExamButton" style="display: none;"/>
	</form>
	</td>
  </tr>
  <tr>
    <td id="pageCov"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="40" align="center"><input type="checkbox" id="checkAll" name="checkAllExam" value="checkbox" onclick="allCheck(this)" ></td>
          <td><label for="checkAll" class="checkAll">全选</label> </td>
        </tr>
      </table></td>
    <td align="right"><p:pages pageSize="${requestScope.examList.pageSize}" actionUrl="examAction!getAllExam" total="${requestScope.examList.total}" currentPage="${requestScope.examList.currentPage}" condition="${requestScope.examList.condition}"></p:pages></td>
      </td>
  </tr>
</table>
</td>
  </tr>
  <tr>
    <td height="50" id="buttonCov"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
		<td class="buttonOut">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td class="buttonLeft"></td>
            <td class="buttonCenter" onMouseDown="buttonDown(this)" onMouseOver="buttonOver(this)" onMouseOut="buttonOut(this)">
			<a href="#" onclick="submitDeleteForm()">批量删除</a>
			</td>
            <td class="buttonRight"></td>
          </tr>
        </table>
		</td>
      </tr>
    </table></td>
  </tr>
</table>
<%
		if (null != request.getAttribute("tips")
				&& !"".equals(request.getAttribute("tips"))) {
		%>
		<script type="text/javascript">
			alert('${requestScope.tips}');
		</script>
		<%
			}
		%>
<script language="javascript" src="http://img.xxt.m-school.cn/wisdom/js/DatePicker/WdatePicker.js" type="text/javascript"></script>
</body>
</html>
